package client.global.commlib

import android.app.Application
import android.content.Context

//import com.tencent.bugly.crashreport.CrashReport

open class BaseApplication : Application() {

    override fun onCreate() {
        super.onCreate()
        instance = this
//        CrashReport.initCrashReport(applicationContext, "bcd331eb88", true);
    }

    override fun attachBaseContext(base: Context?) {
        super.attachBaseContext(base)
        instance = this
    }

    //单例化的第一种方式：声明一个简单的Application属性
    companion object {
        //情况一：声明可空的属性
        private var instance: BaseApplication? = null
        fun getInstance() = instance!!
        //情况二：声明延迟初始化属性
        //private lateinit var instance: MainApplication
        //fun instance() = instance
    }
}